﻿(function ($) {
    $.widget("lordjs.loadAjaxWidget", {
        _create: function () {
            this.randomLayerId = Math.ceil(Math.random() * 100000000000000);
            this.element.append("<div id='layer_" + this.randomLayerId + "' class='loadingLayer' style='position: absolute;'></div>");
            this.randomLayer = $("#layer_" + this.randomLayerId, this.element);
            this.randomLayer.css(this.options);
            this._autoSize();
        },
        _autoSize: function () {
            var that = this;
            that.randomLayer.css({ "top": 0, "left": 0, "height": "100%", "width": "100%" });
        },
        destroy: function () {
            this.randomLayer.remove();
            $.Widget.prototype.destroy.call(this);
        }
    });
})(jQuery)
